<?php if ( ! defined('WDK_PATH')) exit('No direct script access allowed');?>
<!--{**************************************************************************}-->
<style>
ul.tabmenu			{list-style: none;margin: 0px;padding: 0px;}
ul.tabmenu li		{float:left;margin-right:3px;height:32px;}
ul.tabmenu li a		{padding:5px 7px;border:1px solid #D9D9D9;height:18px;}
ul.tabmenu li a.on	{background-color:#DC4616;color:#FFF;}
</style>
<!--{**************************************************************************}-->
<table id="listTable" class="list">
	<caption>
		<div class="fl">
			<ul class="tabmenu">
				<li><a class="on" href="/user/msg">받은쪽지</a></li>
				<li><a href="/user/msg/send">보낸쪽지</a></li>
				<li><a href="/user/msg/form">쓰기</a></li>
			</ul>
		</div>
		<div class="fr">
			총 <span id="total">0</span>개의 쪽지가 있습니다.
		</div>
	</caption>
	<colgroup>
		<col style="width:30px;"/>
		<col style="width:40px;"/>
		<col style="width:*;"/>
		<col style="width:80px;"/>
		<col style="width:140px;"/>
		<col style="width:80px;"/>
	</colgroup>
	<thead>
		<tr>
			<th><input type="checkbox" class="checkAll"/></th>
			<th>No</th>
			<th>제목</th>
			<th>보낸사람</th>
			<th>보낸시간</th>
			<th>읽음</th>
		</tr>
	</thead>
	<tbody data='{json}'></tbody>
	<tfoot>
		<tr>
			<td colspan="8">
				<div id="pagebar" class="fr"></div>
			</td>
		</tr>
	</tfoot>
</table>
{# plugin listmanager #}
<!--{**************************************************************************}-->
<script>
(function($){
	WdListManager.prototype.draw = function(json)
	{
		var tag = [];
		tag.push('<td class="tc"><input type="checkbox" value="'+json.seq+'"/></td>');
		tag.push('<td class="tc">'+json.no+'</td>');
		tag.push('<td class="">&nbsp;&nbsp;<a class="view">'+json.title+'</a></td>');
		tag.push('<td class="tc">'+json.user_nick+'</td>');
		tag.push('<td class="tc">'+json.insert_time+'</td>');
		tag.push('<td class="tc">'+(json.read_flag == 'T' ? "읽음" : "-")+'</td>');
		return tag.join("");
	};
	WdListManager.prototype.draw_event = function()
	{
		$(this.root+'>tbody>tr').map(function(){
			var self = $(this);
			self.find('a.view').click(function(){
				location.href = $PATH+'view/'+self.find(':checkbox').val();
			});
		});
	};
	$(document).ready(function(){
		wlm = new WdListManager($PATH);
		wlm.set_root('#listTable');
		wlm.set_totalbox('#listTable #total');
		wlm.set_pagebar('#listTable #pagebar');
		wlm.preload();
	});
})(jQuery);
</script>
<!--{**************************************************************************}-->